<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"> 

<ui:composition template="../template.xhtml">
		<ui:define name="conteudo">
			<p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>
				<p:dialog modal="true" widgetVar="statusDialog" header="Status"   
			        draggable="false" closable="false">  
				    <h:outputText value="Aguarde..." /> 
			</p:dialog>  
			<div id="location">Manter Associação</div>
			<div id="container">
       			<div id="form">
       				<h:form id="associacaoForm">
       					<h:inputHidden value="#{associacaoMB.associacao.id}" />
       					<p:messages id="growl" showDetail="true" showSummary="false" />
	       						<div class="fundo">
	       						<fieldset>
								<legend>Dados</legend>
		       					<table width="70%" align="left">
	       							<tr>
	       								<td>
	       									<label>
				       							<p>Tipo Pessoa:</p>
				       							<h:selectOneMenu value="#{associacaoMB.associacao.tipoPessoa}" style="width:100px" onkeydown="if(event.keyCode==13) event.keyCode=9;">
				       								<f:selectItem itemLabel="Física" itemValue="PF"/>
				       								<f:selectItem itemLabel="Jurídica" itemValue="PJ"/>
				       							</h:selectOneMenu>
				       						</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>CPF/CNPJ:</p>
					       						<p:inputText value="#{associacaoMB.associacao.cdPess}" style="width:120px" onkeydown="if(event.keyCode==13) event.keyCode=9;" maxlength="14" required="true" requiredMessage="- Digite o CPF/CNPJ."/>
					       					</label>
	       								</td>
	      								<td>
	       									<label>
					       						<p>Razão Social:</p>
					       						<p:inputText value="#{associacaoMB.associacao.razaoSocial}" style="width:300px" maxlength="55" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Digite a Razão Social."/>
					       					</label>
	       								</td>
	       								
	       							</tr>
	       							<tr>
	       								<td>
	       									<label>
					       						<p>Responsável Evento:</p>
					       						<p:inputText value="#{associacaoMB.associacao.nomeRespEvento}" style="width:200px" maxlength="55" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Digite o Responsável Evento."/>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>E-mail Resp. Evento:</p>
					       						<p:inputText value="#{associacaoMB.associacao.emailRespEvento}" style="width:250px" maxlength="50" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Digite o E-mail do Resp. Evento."/>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>Responsável Vistoria:</p>
					       						<p:inputText value="#{associacaoMB.associacao.nomeRespVistoria}"  style="width:300px" maxlength="55" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Digite o Responsável Vistoria."/>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>E-mail Resp. Vistoria:</p>
					       						<p:inputText value="#{associacaoMB.associacao.emailRespVistoria}"  style="width:250px" maxlength="50" onkeydown="if(event.keyCode==13) event.keyCode=9;"  required="true" requiredMessage="- Digite o E-mail do Resp. Vistoria."/>
					       					</label>
	       								</td>
	 								</tr>
	 							</table>
	 							</fieldset>
	 							<fieldset>
								<legend>Endereço</legend>
		       					<table width="70%" align="left">     								
	       							<tr>	
	       								<td>
	       									<label>
					       						<p>CEP:</p>
					       						<p:inputMask mask="99.999-999" value="#{associacaoMB.associacao.cep}"  maxlength="8" style="width:100px" onkeydown="if(event.keyCode==13) event.keyCode=9;"  required="true" requiredMessage="- Digite o Cep."/>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>Estado:</p>
					       						<h:selectOneMenu value="#{associacaoMB.idEstado}" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Selecione o Estado.">
					       							<f:selectItem itemLabel="Selecione" itemValue="0"/>
					       							<f:selectItems value="#{associacaoMB.estadoList}" var="est" itemLabel="#{est.nome} - #{est.sigla}" itemValue="#{est.id}"/>
					       							<p:ajax update="cidade" listener="#{associacaoMB.listaCidades}"/> 
					       						</h:selectOneMenu>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>Cidade:</p>
					       						<h:selectOneMenu value="#{associacaoMB.associacao.idCidade}" id="cidade" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Selecione a Cidade.">
					       							<f:selectItem itemValue="0" itemLabel="Selecione"/>
					       							<f:selectItems value="#{associacaoMB.cidadeList}" var="cid" itemLabel="#{cid.nome}" itemValue="#{cid.id}" />
					       						</h:selectOneMenu>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>Bairro:</p>
					       						<p:inputText value="#{associacaoMB.associacao.bairro}" maxlength="20" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Digite o Bairro."/>
					       					</label>
	       								</td>
	       							</tr>
	       							<tr>
	       								<td colspan="2">
	       									<label style="width: 320px;">
					       						<p>Logradouro:</p>
					       						<p:inputText value="#{associacaoMB.associacao.logradouro}" style="width:320px" maxlength="100" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Digite o Logradouro."/>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>Número:</p>
					       						<p:inputText mask="999999999" value="#{associacaoMB.associacao.numero}"  maxlength="11" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Digite o Número."/>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>Complemento:</p>
					       						<p:inputText value="#{associacaoMB.associacao.complemento}" maxlength="20" onkeydown="if(event.keyCode==13) event.keyCode=9;"/>
					       					</label>
	       								</td>
	       							</tr>
	       						</table>
	       						</fieldset>
	       						<fieldset>
								<legend>Contato</legend>
		       					<table width="50%" align="left">
	       							<tr>       								
	       								<td>
	       									<label>
					       						<p>Nome Contato:</p>
					       						<p:inputText value="#{associacaoMB.associacao.nomeContato}" style="width:320px" maxlength="55" onkeydown="if(event.keyCode==13) event.keyCode=9;" required="true" requiredMessage="- Digite o Nome do Contato."/>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>Email:</p>
					       						<p:inputText value="#{associacaoMB.associacao.email}" style="width:250px" maxlength="50" onkeydown="if(event.keyCode==13) event.keyCode=9;"  required="true" requiredMessage="- Digite o E-mail do Contato."/>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>Telefone 1:</p>
					       						<p:inputMask mask="(99) 9999-9999" value="#{associacaoMB.associacao.telefone1}"  maxlength="10" style="width:100px" onkeydown="if(event.keyCode==13) event.keyCode=9;"  requiredMessage="- Digite o Telefone 1."/>
					       					</label>
	       								</td>
	       								<td>
	       									<label>
					       						<p>Telefone 2:</p>
					       						<p:inputMask mask="(99) 9999-9999" value="#{associacaoMB.associacao.telefone2}"   maxlength="10" style="width:100px" onkeydown="if(event.keyCode==13) event.keyCode=9;"/>
					       					</label>
	       								</td>
	       								<td colspan="2"></td>
	       							</tr>
	       						</table>
	       						</fieldset>
			       				</div>
			       				<p:spacer height="20"/>
			       				<div align="right" style="padding-right: 20px; padding-bottom: 10px;">
			       					<p:commandButton value="Salvar" action="#{associacaoMB.saveOrUpdate}" update="growl associacaoForm"/>
			       					<p:spacer width="10"/>
			       					<p:commandButton value="Voltar" action="#{associacaoMB.paginaBusca}" ajax="false" immediate="true"/>
			       				</div>
       				</h:form>
       			</div>
       		</div>
		</ui:define>
</ui:composition>		
</html>